{% extends 'base.html' %}

{% block content %}

<form action="{% url 'service_list' %}" method="get">
    <div class="btn-group" role="group">
        {% for list in groupName %}
            <button type="submit" class="btn btn-default" name="projectName" value="{{ list }}">{{ list }}</button>
        {% endfor %}
    </div>
</form>

<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5> 资源信息 </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="feed-activity-list">
                        {% for res in svc_res %}
                            <div class="feed-element">
                                <div class="media-body">
                                    <strong><a href="{% url 'resource_list' %}?res_name={{ res.res.name }}">{{ res.res.name }}</a></strong><br>
                                    <small class="text-muted">{{ res.res.comment }} - {{ res.res.category }}/{{ res.res.type.name }}</small>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins" id="all">
                <div class="ibox-title">
                    <h5> Services详细信息列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <form action="{% url 'getServices' %}" method="post" id="checkall">

                        <table class="table table-striped table-bordered table-hover " id="editable" name="editable">
                            <thead>
                                <tr>
                                    <th class="text-center"> 实例名称 </th>
                                    <th class="text-center"> 运行环境 </th>
                                    <th class="text-center"> IP地址 </th>
                                    <th class="text-center"> salt minion </th>
                                    <th class="text-center"> owner </th>
                                    <th class="text-center"> has_statsd </th>
                                    <th class="text-center"> has_sentry </th>
                                    <th class="text-center"> comment </th>

                                </tr>
                            </thead>
                            <tbody>
                            {% for services in project %}
                                <tr class="gradeX">
                                    <td class="text-center">{{ services.name }}</td>
                                    <td class="text-center">{{ services.get_env_display }}</td>
                                    <td class="text-center">{{ services.ip }}</td>
                                    <td class="text-center">{{ services.saltminion.saltname }}</td>
                                    <td class="text-center">{{ services.owner }}</td>
                                    <td class="text-center">{{ services.has_statsd }}</td>
                                    <td class="text-center">{{ services.has_sentry }}</td>
                                    <td class="text-center">{{ services.comment }}</td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </form>
                </div>
                <ul class="pager">
                    {% if project.has_previous %}
                        <li><a href="?projectName={{ project_name }}&page={{ project.previous_page_number }}">Previous</a></li>
                    {% endif %}
                        <li>Page {{ project.number }} of {{ project.paginator.num_pages }}.</li>
                    {% if project.has_next %}
                        <li><a href="?projectName={{ project_name }}&page={{ project.next_page_number }}">Next</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
</div>
{% endblock %}



